#!/usr/bin/python
# -*- coding: utf-8 -*-

import h5py
import numpy as np
import time


def load_data(filename):
    labels = []
    images = []



    with h5py.File('number.h5', 'r') as f:
        a = f.keys()
        print(list(a))
        for key in a:
            count = len(f[key])

            indextmps = [int(key) for x in range(count)]
            labels.extend(indextmps)
            images.extend(f[key])

    labels = np.array(labels)
    images = np.array(images)

    print(labels.shape)
    print(images.shape)


    return images,labels


if __name__ == '__main__':
    t1 = time.clock()
    load_data('number.h5')
    t2 = time.clock()
    print(t2 - t1)